class Solution
{
public:
    void rotate(vector<vector<int>>& matrix)
    {
        int n = matrix.size();
        vector<vector<int>> vec = matrix;
        int tmp = -1;
        for (int i = 0; i < n; i++)
        {
            tmp++;
            int rec = n - 1;
            for (int j = 0; j < n; j++)
            {
                matrix[i][j] = vec[rec][tmp];
                rec--;
            }
        }
    }
};